package dict

import (
	"context"
	"fast-boot/app/model"
	"strings"

	"fast-boot/app/api/admin/internal/svc"
	"fast-boot/app/api/admin/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type DataDelLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewDataDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DataDelLogic {
	return &DataDelLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *DataDelLogic) DataDel(req *types.SysDictDataDelReq) (resp *types.SysDictDataDelResp, err error) {

	l.svcCtx.GormClient.GormDb.Delete(&model.SysDictDataModel{}, strings.Split(req.Ids, ","))
	return &types.SysDictDataDelResp{}, nil
}
